//
//  HMButton.swift
//  EmotionKeybaord
//
//  Created by ZhuDong on 16/5/31.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

class HMEmotionButton: UIButton {

    var emotion:HMEmotion?{
        didSet{
            if let imagePath = emotion!.imagePath {
                setImage(UIImage(named: imagePath), forState: .Normal)
                setTitle(nil, forState: .Normal)
            }
            if let title = emotion!.emoji {
                setImage(nil, forState: .Normal)
                setTitle(title, forState: .Normal)
            }
            if emotion!.isEmpty {
                setImage(nil, forState: .Normal)
                setTitle(nil, forState: .Normal)
            }
            if emotion!.isDelete {
                setImage(UIImage(named: "compose_emotion_delete"), forState: .Normal)
            }
        }
    }
}
